package com.shop.junit;

import com.shop.mapper.EmployeeMapper;
import com.shop.pojo.Employee;
import com.shop.service.EmployeeService;
import org.apache.shiro.crypto.hash.Md5Hash;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.List;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"classpath:spring/applicationContext.xml","classpath:spring/springmvc.xml"})
public class TestEmployee {

    @Autowired
    private EmployeeMapper mapper;
    @Autowired
    private EmployeeService service;

    @Test
    public void Employee() {
        List<Employee> list = service.findEmployeeList();
        for (Employee employee : list) {
            System.out.println(employee.getId()+"."+employee.getName()+"."+employee.getPassword());

        }
    }

    public static void main(String[] args) {
        String salt = "";
        Md5Hash md5Hash = new Md5Hash("1", salt, 2);
        System.out.println(md5Hash.toHex());

    }

}
